<template>
	<view>
		<view class="" v-for="(item,index) in signList.list">
			<view class="" style=" width: 95%; margin: auto;margin-top: 40rpx;">
				<view class="cellview">
					<van-cell-group>
						<van-cell :title="item.title" is-link @click="signDetail" :value="item.groupEnt.groupName"
							size="large" :data-index="index" :data-id="item.id"/>
					</van-cell-group>
				</view>
			</view>
		</view>

		<!-- 弹出框 -->
		<van-dialog id="van-dialog" :show-cancel-button="true" @close="onClose" />
	</view>
</template>

<script>
	import wrap from '@/components/wrap';
	import Dialog from '../../wxcomponents/vant/dialog/dialog';
	export default {
		data() {
			return {
				signList: {
					"status": 1,
					"message": null,
					"data": null,
					"list": [{
						"id": 1,
						"title": "第一次签到",
						"issuer": 3,
						"startTime": "2021-11-26 14:14:20",
						"aimGroup": 12,
						"groupEnt": {
							"id": 12,
							"groupName": "软件开发七号群",
							"leaderId": null,
							"creatTime": null,
							"joinAuth": null,
							"leve": null
						},
						"labelId": 1,
						"labelEnt": {
							"id": 1,
							"labelNum": null,
							"title": "广电大厦7021北门"
						},
						"limitTime": "2021-11-28 14:14:20",
						"aimUserIdList": null
					}],
					"pageNum": 1,
					"pageSize": 5,
					"totalPage": 1,
					"firstPage": true,
					"lastPage": true
				}
			}
		},
		methods: {
			//签到信息
			signDetail(e) {
				console.log(e)
				Dialog.alert({
					message: `签到名称：${this.signList.list[e.target.dataset.index].title}\n
					针对群组：${this.signList.list[e.target.dataset.index].groupEnt.groupName}\n
					开始时间：${this.signList.list[e.target.dataset.index].startTime}\n
					结束时间：${this.signList.list[e.target.dataset.index].limitTime}\n
					标签卡：${this.signList.list[e.target.dataset.index].labelEnt.title}`,
					showCancelButton:"true"
				}).then(() => {
					uni.navigateTo({
					    url: '../finish_process/finish_process?id='+e.target.dataset.id
					});
				}).catch(() => {
					
				});
			},
			//查询签到任务
			findSign() {
				uni.request({
					url: this.apiurl + '/sign/user_sign', //仅为示例，并非真实接口地址。
					header: {
						'Authorization': uni.getStorageSync('token') //自定义请求头信息
					},
					data: {
						pageNum: 1,
						pageSize: 20
					},
					success: (res) => {
						console.log(res.data)
						this.signList = res.data
					}
				});
			}
			//
		},
		onShow() {
			//检查登录状态
			this.checkLogin();
			//更新token
			// this.aginLogin();
			//查询签到任务
			this.findSign();
		}

	}
</script>

<style>
	.van-cell {
		border-radius: 10rpx;
	}
</style>
